package com.job.netease;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

/**
 * @ClassName: test.Netease44
 * @Description:
 * @Author: 12071
 * @Date: 2022/4/16 16:53
 */


public class Netease44 {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer str = new StringTokenizer(in.readLine());
        int n = Integer.parseInt(str.nextToken());
        str = new StringTokenizer(in.readLine());
        int[] vals = new int[n];
        for (int i = 0; i < n; i++) {
            vals[i] = Integer.parseInt(str.nextToken());
        }

        long [] dp = new long[n];
        long c_2 = 0;
        long c_5 = 0;
        for(int i = 0; i < n; i++){

            long cc_2 = 0;
            long cc_5 = 0;
            while(vals[i] % 2 == 0){
                cc_2 ++;
                vals[i] /= 2;
            }
            while(vals[i] % 5 == 0){
                cc_5 ++;
                vals[i] /= 5;
            }

            c_2 += cc_2 * (i + 1);
            c_5 += cc_5 * (i + 1);
            dp[i] = Math.min( c_2,  c_5);
            // System.out.println(dp[i]);
        }

        long res =0;

        for(long i : dp){
            res += i;
        }
        System.out.println(res);


    }
}



